$(function(){
	var mySwiper = new Swiper('.swiper-container', {
		autoplay: true, //可选选项，自动滑动
		direction: 'horizontal', //横向切换
		loop: true,
		speed: 1000,
		navigation: {
			nextEl: '.swiper-button-next',
			prevEl: '.swiper-button-prev',
		},
		pagination: {
			el: '.swiper-pagination',
			clickable: true,
		}
	})
	//鼠标滑过pagination控制swiper切换
	for (i = 0; i < mySwiper.pagination.bullets.length; i++) {
		mySwiper.pagination.bullets[i].onmouseover = function() {
			this.click();
		};
	}
	//鼠标移出隐藏按钮，移入显示按钮
	mySwiper.el.onmouseover = function() {
		mySwiper.navigation.$nextEl.removeClass('hide');
		mySwiper.navigation.$prevEl.removeClass('hide');
	}
	mySwiper.el.onmouseout = function() {
		mySwiper.navigation.$nextEl.addClass('hide');
		mySwiper.navigation.$prevEl.addClass('hide');
	}
	
	/* ----------关于选择账户还是手机登录----------- */
	$(".i_one").addClass("i_userlogin_background");
	$(".i_two").css("background","white");
	
	$(".i_one").click(function(){
		$(this).addClass("i_userlogin_background");
		$(this).removeClass("active");
		$(".i_two").removeClass("active");
		$(".i_two").removeClass("i_userlogin_background");
	})
	$(".i_one,i_two").hover(function(){
		$(this).css("background","white")
	})
	
	$(".i_two").click(function(){
		$(this).addClass("i_userlogin_background");
		$(this).removeClass("active");
		$(".i_one").removeClass("active");
		$(".i_one").removeClass("i_userlogin_background");
	})
	$(".i_userlogin_ul_li").blur(function(){
		$(this).css("background","white");
	})
		/* ----------关于选择账户还是手机登录完----------- */
		

		$(".i_attention_ul li").click(function(){
			$(this).siblings().css("background","white");
		})
	/* 	$(".i_attention_li").prev().siblings().children(".i_attention_li").css("background","white") */
})
/* 登录 */
function account_submit(){
	if(account_pd()){
		$("#loginForm").submit();
	}
}
/* 手机号登录 */
function phone_submit(){
	if(phone_pd()){
		$("#registerForm").submit();
	}
}
/* 登录验证 */
function account_pd(){
	var account = $(".account").val();
	var account_pwd=$(".account_pwd").val();
	if(account.length <=0 || null == account){
		layer.msg('请输入账户',{icon:2});
		$(".account").css("border","0.5px solid red");
		return false;
	}else{
		$(".account").css("border","0.5px solid #CCCCCC");
	}
	if(account_pwd.length <=0 || null == account_pwd){
		layer.msg('请输入密码',{icon:2});
		$(".account_pwd").css("border","0.5px solid red");
		return false;
	}else{
		$(".account_pwd").css("border","0.5px solid #CCCCCC");
		return true;
	}
}
/* 手机号验证 */
function phone_pd(){
	var phone = $(".phone").val();
	var verification=$(".verification").val();
	
	var mobileReg = /^1[3-9]\d{9}$/;
	if(phone.length <=0 || null == phone){
		layer.msg('请输入手机号',{icon:2});
		$(".phone").css("border","0.5px solid red");
		return false;
	}else if(mobileReg.test(phone)==false||phone.length <11){
		layer.msg('请输入正确的手机号',{icon:2});
		return false;
	}else{
		$(".phone").css("border","0.5px solid #CCCCCC");
	}
	
	if(verification.length <=0 || null == verification){
		layer.msg('请输入验证码',{icon:2});
		$(".verification").css("border","0.5px solid red");
		return false;
	}else{
		$(".verification").css("border","0.5px solid #CCCCCC");
		return true;
	}
}